package observerPattern;

import java.util.ArrayList;

/**
 * Created by JiaJia on 2019/6/16 0016.
 */
public abstract class AllyController {
    protected String allyName;
    protected ArrayList<Observer> players=new ArrayList<Observer>();

    public void setAllyName(String allyName){
        this.allyName=allyName;
    }
    public String getAllyName(){
        return this.allyName;
    }
    public void join(Observer obs){
        System.out.println(obs.getName()+"加入"+this.allyName+"战队！");
        players.add(obs);
    }
    public void quit(Observer obs){
        System.out.println(obs.getName()+"退出"+this.allyName+"战队！");
        players.remove(obs);
    }
    public abstract void notifyObserver(String name);
}